/*!
* @file rgbthresh.h
* @author Yasutomo Kawanishi
* @date Last Change: 2011/Feb/24.
* */

#ifndef __BACKGROUND_SUBTRACTOR_RGBTHRESH__
#define __BACKGROUND_SUBTRACTOR_RGBTHRESH__
#include <cv.h>
#include <string>
/**
* @class BackgroundSubtractorRGBThresh
* @brief compare to a threshold for each channels
*
* */
class BackgroundSubtractorRGBThresh{
public:
	BackgroundSubtractorRGBThresh(const cv::Mat& bgimage, const cv::Scalar& thresh=cv::Scalar(128,128,128));
	BackgroundSubtractorRGBThresh(const cv::Scalar& thresh=cv::Scalar(128,128,128));
	~BackgroundSubtractorRGBThresh();
	BackgroundSubtractorRGBThresh(const BackgroundSubtractorRGBThresh& other);
	const BackgroundSubtractorRGBThresh& operator=(const BackgroundSubtractorRGBThresh& other);

	void setBGImage(const cv::Mat& bgimage);
	void setBGImage(const std::string& bgfilename);
	cv::Mat getBGImage()const;
	cv::Scalar getThreshold()const;

	void setThreshold(const cv::Scalar& thresh);

	void apply(const cv::Mat& img, cv::Mat& oimg);

private:
	bool isInit;
	cv::Mat bgimage;
	cv::Scalar thresh;
	cv::Mat diff;
	std::vector<cv::Mat> ch;
};
#endif
